package try_;

/**
 * @Author 小闽
 * @Date 2024/9/23 16:42
 * @PackageName: try_
 * @ClassName: TryCatchDetail02
 * @Description: try-finally
 * @Version 1.0
 */
public class TryCatchDetail02 {
    public static void main(String[] args) {
        // 当try中的代码块没有出现异常后，那么finally中的代码会被执行，然后后面的代码会被依次执行
        try {
            int num1 = 10;
            int num2 = 2;
            int res = num1 / num2;
            System.out.println("res= " + res);
        } finally {
            System.out.println("finally最终会被执行...");
        }
        System.out.println("程序继续执行...");
    }
}
